﻿@model AutomatedTestDataManagement.Models.PagesField

@if(ViewData["DeleteFromPage"] == null)
{
                   <tr>
                       <td>
                           @Html.DisplayFor(modelItem => modelItem.HTMLField.FieldName)
                       </td>
                       <td>
                           @Html.DisplayFor(modelItem => modelItem.HTMLField.FieldType.FieldTypeName)
                       </td>
                       <td>
                           @if (ViewBag.SiteID != null)
                           {
                               if(ViewData["DeletePage"] == null)
                               {
                                    @Html.ActionLink("Edit Field", "Edit", "HTMLField", new { id = Model.FieldID, pageID = Model.PageID, siteID = ViewBag.SiteID }, null) @Html.Encode(" | ")
                                    @Html.ActionLink("Remove Field from Page", "Delete", "PagesField", new { id = Model.PageFieldID, pageID = Model.PageID, siteID = ViewBag.SiteID }, null)
                                }
                                else
                                {
                                   @Html.ActionLink("Remove Field from Page", "Delete", "PagesField", new{id = Model.PageFieldID, pageID = Model.PageID, siteID = ViewBag.SiteID, returnToView = "Delete"}, null)
                               }
                           }
                           else
                           {
                               if(ViewData["DeletePage"] == null)
                               {
                                     @Html.ActionLink("Edit Field", "Edit", "HTMLField", new { id = Model.FieldID, pageID = Model.PageID }, null) @Html.Encode(" | ")
                                     @Html.ActionLink("Remove Field from Page", "Delete", "PagesField", new { id = Model.PageFieldID, pageID = Model.PageID}, null)
                                }
                                else
                                {
                                   @Html.ActionLink("Remove Field from Page", "Delete", "PagesField", new{id = Model.PageFieldID, pageID = Model.PageID, returnToView = "Delete"}, null)
                               }
                           }
                       </td>
                   </tr>
}
else
{
    <tr>
        <td>
            @Html.DisplayFor(m => m.Page.PageName)
        </td>
        <td>
            @Html.DisplayFor(m => m.Page.PagePath)
        </td>
        <td>
            @Html.ActionLink("Remove Field from this Page", "Delete", "PagesField", new { id = Model.PageFieldID, fieldID = Model.FieldID, returnToView = "Delete" }, null)
        </td>
    </tr>
}